﻿<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
		<meta name="apple-mobile-web-app-capable" content="yes" />
		<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
		<meta name="apple-mobile-web-app-title" content="思路广惠">
		<title>登录</title>

		<meta content="telephone=no" name="format-detection" />

		<link rel="stylesheet" type="text/css" href="../../src/css/base.css?1.0" />
	</head>

	<body class="login-body">
		<div class="login-bg">
			<header class="centre top1rem">
				<img class="login-he-img" src="../../src/images/login175x178.png" />
				<h1><span class="login-he-span"> 丝路广惠欢迎您！</span></h1>
			</header>
			<!--会员登录-->
			<section id="menberLogin">
				<h1 class="login-h1">会员登录</h1>
				<div class="login-inp">
					<label for="phone"><img class="label-m" src="../../src/images/login-phone21x29.png" /></label>
					<input type="tel" id="phone" placeholder="请输入手机号" required />
				</div>
				<div class="login-inp">
					<label for="pwd"><img   class="label-m" src="../../src/images/login-pwd20x23.png" /></label>
					<input type="password" id="pwd" placeholder="请输入密码" required />
				</div>
				<button id="forgetPwd" class="login-forget" type="button">忘记密码</button>
				<button class="login-btn huef36" type="button" id="signIn">登录</button>
				<button class="login-btn login-btn-no" type="button" id="signUp">注册</button>
				<footer class="top1rem btm1rem">
					<h2 class="s12m centre">第三方登录</h2>
					<div class="login-foo-f top1rem">
						<a href="#"><img class="login-foo-m" src="../../src/images/qq.png" /></a>
						<a href="#"><img class="login-foo-m" src="../../src/images/weix.png" /></a>
						<a href="#"><img class="login-foo-m" src="../../src/images/weibo.png" /></a>
					</div>
				</footer>
			</section>
			<footer class="login-down" id="foot">
				<a href="javascript: history.go(-1)" class="huefff s13m">返回</a>
			</footer>
		</div>

		<!--会员注册-->
		<!--会员修改密码-->
		<!--<div class="member-register">
        <div class="member-register-pic"> <img src="../../src/images/login175x178.png"/></div>
        <div class="welcome">丝路广惠欢迎您！</div>
        <div class="member-register-tit">找回密码</div>
        <div class="member-register-form">
            <div class="member-register-grop-bg member-register-grop">
                <label for="phone" class="label-phone"></label>
                <input type="tel" id="phone" placeholder="请输入手机号">
            </div>
            <div class="member-register-grop-code">
                <div class="member-register-grop-code-bg">
                    <label for="yz" class="label-code"></label>
                    <input type="text" id="yz" placeholder="验证码">
                </div>
                <button type="button" class="member-register-grop-btn">获取验证码</button>
            </div>


            <button class="member-register-grop-bg member-login-btn"  >下一步</button>

        </div>
        <div class="member-share-back"><a href="#">返回</a></div>
    </div>-->
		<!--会员修改密码确认-->
		<!--<div class="member-register">
            <div class="member-register-pic"> <img src="../../src/images/login175x178.png"/></div>
            <div class="welcome">丝路广惠欢迎您！</div>
            <div class="member-register-tit">找回密码</div>
            <div class="member-register-form">

                <div class="member-register-grop-bg member-register-grop">
                    <label for="pwd" class="label-pwd"></label>
                    <input type="password" id="pwd" placeholder="请输入新密码">
                </div>
                <div class="member-register-grop-bg member-register-grop">
                    <label for="repwd" class="label-pwd"></label>
                    <input type="password" id="repwd" placeholder="请再次输入密码">
                </div>
                <button class="member-register-grop-bg member-login-btn">确定</button>

            </div>
            <div class="member-share-back"><a href="#">返回</a></div>
        </div>
    -->
		<script type="text/html" id="memberSignup">
			<h1 class="login-h1">会员登录</h1>
			<div class="login-inp">
				<label for="phone"><img class="label-m" src="../../src/images/login-phone21x29.png" /></label>
				<input type="tel" id="phone" placeholder="请输入手机号" required />
			</div>
			<div class="login-inp">
				<label for="pwd"><img class="label-m" src="../../src/images/login-pwd20x23.png" /></label>
				<input type="password" id="pwd" placeholder="请输入密码" required />
			</div>
			<button id="forgetPwd" class="login-forget" type="button">忘记密码</button>
			<button class="login-btn huef36" type="button" id="signIn">登录</button>
			<button class="login-btn login-btn-no" type="button" id="signUp">注册</button>
			<footer class="top1rem btm1rem">
				<h2 class="s12m centre">第三方登录</h2>
				<div class="login-foo-f top1rem">
					<a href="#"><img class="login-foo-m" src="../../src/images/qq.png" /></a>
					<a href="#"><img class="login-foo-m" src="../../src/images/weix.png" /></a>
					<a href="#"><img class="login-foo-m" src="../../src/images/weibo.png" /></a>
				</div>
			</footer>
		</script>
		<script type="text/html" id="memberSignon">
			<h1 class="login-h1">会员注册</h1>
			<div class="login-inp">
				<label for="phone"><img class="label-m" src="../../src/images/login-phone21x29.png" /></label>
				<input type="tel" class="loginMember" id="phone" placeholder="请输入手机号" required />
			</div>
			<div class="flexs">
				<div class="login-inp login-inp-code">
					<label for="phone"><img class="label-m" src="../../src/images/login-yz26x26.png" /></label>
					<input type="text" class="loginMember" id="codes" placeholder="验证码">
				</div>
				<button type="button" class="login-code">获取验证码</button>
			</div>
			<div class="login-inp">
				<label for="pwd"><img class="label-m" src="../../src/images/login-pwd20x23.png" /></label>
				<input type="password" class="loginMember" id="pwd" placeholder="请输入密码" required />
			</div>
			<div class="login-inp">
				<label for="pwd"><img class="label-m" src="../../src/images/login-pwd20x23.png" /></label>
				<input type="password" class="loginMember" id="repwd" placeholder="请再次输入密码" required />
			</div>
			<button class="login-btn huef36" type="button" id="loginIn">注册</button>
			<footer class="top1rem btm1rem">
				已阅读并同意
				<a href="#" class="white">《丝路广惠用户协议》</a> ，<strong>接受免除或限制责任、诉讼管辖约定</strong> 等粗体下划线标示条款，愿意同步创建丝路广惠商城账户。
			</footer>
		</script>
		<script type="text/html" id="memberPwd">
			<h1 class="login-h1">找回密码</h1>
			<div class="login-inp">
				<label for="phone"><img class="label-m" src="../../src/images/login-phone21x29.png" /></label>
				<input type="tel" class="loginMember" id="phone" placeholder="请输入手机号" required />
			</div>
			<div class="flexs">
				<div class="login-inp login-inp-code">
					<label for="phone"><img class="label-m" src="../../src/images/login-yz26x26.png" /></label>
					<input type="text" class="loginMember" id="codes" placeholder="验证码">
				</div>
				<button type="button" class="login-code">获取验证码</button>
			</div>
			<button class="login-btn huef36" type="button">下一步</button>
		</script>
		<script type="text/html" id="memberPwds">
			<h1 class="login-h1">找回密码</h1>
			<div class="login-inp">
				<label for="pwd"><img class="label-m" src="../../src/images/login-pwd20x23.png" /></label>
				<input type="password" class="loginMember" id="pwd" placeholder="请输入密码" required />
			</div>
			<div class="login-inp">
				<label for="pwd"><img class="label-m" src="../../src/images/login-pwd20x23.png" /></label>
				<input type="password" class="loginMember" id="repwd" placeholder="请再次输入密码" required />
			</div>
			<button class="login-btn huef36" type="button">确定</button>
		</script>
		<script src="http://apps.bdimg.com/libs/laytpl.js/1.1/laytpl.js"></script>
		<script src="//cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
		<script src="../../src/js/jquery-md5.js" type="text/javascript" charset="utf-8"></script>
		<script src="../../src/js/all.js" type="text/javascript" charset="utf-8"></script>
		<script src="//cdn.bootcss.com/layer/3.0.1/mobile/layer.js"></script>
		<script type="text/javascript">
			var getAjaxs = function(opts) { //type, url, data, before, callback
				$.ajax({
					type: opts.type,
					url: urls + opts.url,
					data: opts.data,
					beforeSend: opts.before,
					success: opts.callback
				});
			};

			// 点击登录
			$(document).on("click", "#signIn", function() {
				var $phone = $("#phone").val();
				var $pwd = $("#pwd").val();
				if(!/^1\d{10}$/.test($phone)) {
					layers("号码输入有误");
				} else if(!/^[\w]{6,12}$/.test($pwd)) {
					layers("请输入密码");
				} else {
					getAjaxs({
						type: "post",
						url: "/WorkMembers/AppLogin",
						data: {
							LoginName: $phone,
							LoginPwd: $.md5($pwd),
							AppID: AppID,
							Token: Token,
							DeviceType: "App",
							Device: ""
						},
						callback: function(res) {
							console.log(res)
							if(res.Return_ID == 999) { // 0
								sessionStorage.MembersID = "90DDF5E7-2328-4B13-AEF3-6799CB06FCE7"; // res.Return_Mess
								layers(res.Return_Mess, function() {
									location.replace(silks.getByVal("backurl"));
								});
							} else {
								layers(res.Return_Mess)
							}

						}
					});

				}
			});

			// 切换注册
			$(document).on("click", "#signUp", function() {
				$("#menberLogin").html($("#memberSignon").html());
				$("#foot").html('<a href="javascript: void(0)" class="huefff s13m" id="loginUp">登录</a>')
			});
			// 切换登录
			$(document).on("click", "#loginUp", function() {
				$("#menberLogin").html($("#memberSignup").html());
				$("#foot").html('<a href="javascript: history.go(-1)" class="huefff s13m">返回</a>')
			});

			//忘记密码 

			$(document).on("touchstart", "#forgetPwd", function(e) {
				$("#menberLogin").html($("#memberPwd").html());
				$("#foot").html('<a href="javascript: void(0)" class="huefff s13m" id="loginUp">返回</a>')
			});

			// 点击注册
			$(document).on("click", "#loginIn", function() {
				var $loginMember = $(".loginMember");
				if(!/^1\d{10}$/.test($loginMember.eq(0).val())) {
					layers("号码输入有误");
				} else if(!$loginMember.eq(1).val()) {
					layers("请输入验证码");
				} else if(!/^[\w]{6,12}$/.test($loginMember.eq(2).val())) {
					layers("密码为6-16的数字、字母组成");
				} else if($loginMember.eq(2).val() !== $loginMember.eq(3).val()) {
					layers("两次密码不相同");
				} else {
					getAjaxs({
						type: "post",
						url: "/WorkMembers/Register",
						data: {
							MembersID: MembersID,
							LoginName: $loginMember.eq(0).val(),
							Ver: $loginMember.eq(1).val(),
							LoginPwd: $.md5($loginMember.eq(3).val()),
							AppID: AppID,
							Token: Token
						},
						before: function() {
							layer.open({
								type: 2,
								shadeClose: false
							});
						},
						callback: function(res) {
							console.log(res)

							layers(res.Return_Mess, function() {
								layer.closeAll();
							})

						}
					});
				}

			});
		</script>
	</body>